package com.lablzh.gdxy.repository;

import com.lablzh.gdxy.entity.Password;
import com.lablzh.gdxy.entity.Student;

import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;

import javax.transaction.Transactional;
import java.util.Optional;

public interface StudentRepositoty extends JpaRepository<Student,Integer> {


    Student findAllByStID(String stID);
    @Override
    Optional<Student> findById(Integer id);

    @Transactional
    @Modifying
    @Query("update Student set password=?2 where stID=?1")
    void updatePasswordByStID(String username, String password);
}
